package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.MarketFDBean;
import com.lwj.liwanjia.bean.MarketFenleiBean;
import com.lwj.liwanjia.impl.MarketFDView;
import com.lwj.liwanjia.impl.MarketleftView;
import com.lwj.liwanjia.model.MarketFDetailModel;
import com.lwj.liwanjia.model.MarketShangpinModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/9/26.
 */

public class MarketFDetailPresenter {
    private MarketFDView marketFDView;
    private MarketFDetailModel marketFDetailModel;

    public MarketFDetailPresenter(MarketFDView marketFDView) {
        this.marketFDView = marketFDView;
        marketFDetailModel = new MarketFDetailModel();
    }

    public void getMarkFDetail( int shopInfoId, String supType) {
        if (marketFDView != null) {
            marketFDetailModel.getMarketFDetail( shopInfoId, supType, new Subscriber<MarketFDBean>() {
                @Override
                public void onCompleted() {
                    marketFDView.hideProgress();
                }

                @Override
                public void onError(Throwable e) {
                    marketFDView.showError((Exception) e);
                    marketFDView.hideProgress();
                }

                @Override
                public void onNext(MarketFDBean marketFDBean) {
                    marketFDView.getMarketFDDetail(marketFDBean);
                }

                @Override
                public void onStart() {
                    super.onStart();
                    marketFDView.showProgress();
                }
            });
        }
    }
}
